/*
 *create by Allen 前端拦截，带上token
 */
authConfig.$inject = [

    '$rootScope',
    '$transitions'
];
function authConfig($rootScope,$transitions) {

    $transitions.onStart( { to: 'manager.*' },function(trans){
        var toState = trans.to();
        var $state = trans.router.stateService;
        if(toState.name=='login'||toState.name=='register'){
            return;
        }


        if(!$rootScope.user || !$rootScope.user.token){

            $state.transitionTo('login');
        }
    });

}

module.exports = authConfig;